using Autofac.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace EquipmentModule
{
    public class Program
    {
        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                            .UseServiceProviderFactory(new AutofacServiceProviderFactory())
                            .ConfigureLogging(log =>
                            {
                                log.ClearProviders();
                                log.AddConsole();
                                log.AddLog4Net($"{System.IO.Directory.GetCurrentDirectory()}/log4net.config");
                            })
                            .ConfigureServices((hostContext, services) =>
                            {
                                services.AddHostedService<Worker>();
                            })
                            .ConfigureWebHostDefaults(webBuilder =>
                            {
                                webBuilder.UseUrls("http://0.0.0.0:10002").UseStartup<Startup>();
                            });
        
        
        
    }
}
